Skip to content

fix(compat): redirect gl* dlsym(RTLD_DEFAULT) lookups to OpenGLES.framework - #281

Open
diyuksh wants to merge 1 commit into
PlayCover:masterfrom
diyuksh:fix/opengles-dlsym-shadowing
Open

diyuksh wants to merge 1 commit into
PlayCover:masterfrom
diyuksh:fix/opengles-dlsym-shadowing

Conversation

@diyuksh

@diyuksh diyuksh commented Nov 30, 2026

Copy link
Copy Markdown

Summary

  • Interpose dlsym in PlayLoader.m (pt_dlsym) so dlsym(RTLD_DEFAULT, "gl...") lookups check an already-loaded OpenGLES.framework (RTLD_NOLOAD) before falling through to the default lookup.

Why

On macOS (Catalyst), apps and games that resolve OpenGL ES entry points dynamically via dlsym(RTLD_DEFAULT, "gl...") (such as glGetString) can accidentally resolve symbols from macOS's libGL.dylib instead of iOS Support's OpenGLES.framework. Calling libGL.dylib's glGetString without a macOS CGL context crashes on launch (EXC_BAD_ACCESS / null pointer dereference).

Because pt_dlsym uses RTLD_LAZY | RTLD_NOLOAD, it only redirects gl* symbols once OpenGLES.framework is already loaded in the process and falls back to dlsym(handle, symbol) for everything else.

Testing & Known Limitations

  • Built PlayTools (Release, generic/platform=iOS, converted to maccatalyst 11.0 14.0 via vtool) and tested with an OpenGL ES iOS game (com.miniclip.8ballpoolmult 56.36.1) that previously crashed immediately on launch in libGL.dylib glGetString.
  • With this change, the app gets past the libGL.dylib crash, initializes OpenGLES2, compiles/links shaders, and opens its window.
  • Security / anti-tamper note: Even with the OpenGL ES lookup fixed, apps that bundle runtime anti-tamper / integrity protections (such as Appdome / libloader.framework) are still unable to stay open because they detect the re-signed Catalyst/PlayCover environment and exit voluntarily shortly after launch. This PR only addresses the OpenGLES vs libGL.dylib symbol-shadowing crash and does not bypass application security or anti-tamper checks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant